class Category < ActiveRecord::Base

  #  belongs_to :object , :polymorphic => true

  has_many :articles

  #ModelCategory.get_categories(Article, "other_cate")
  def self.get_categories(model, cate = "cate")
    where(:object_type => model.to_s, :cate => cate)
  end

  def self.get_options(model, cate = "cate")
    c = Category.get_categories(model, cate)
    c.present? ? c.map { |i| [i.name, i.id] } : []
  end

end
